﻿/*
 * Twipler - Twitter Web Client with features.
 *  
 *  Copyright (C) 2009, 2010. Ian Quigley
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details. 
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */

using Twipler.Data.Entity.Twipler;
using Twipler.Xtensions;

namespace Twipler.WebApp
{
    public class AppMenu
    {
        public enum Section
        {
            Root, User, Admin, Sandbox, Theme 
        }

        public class Item
        {
            public string DisplayName;
            public string Page;
            public Section Section;
            public VisitorRole Required;

            public string PageLink 
            {
                get
                {
                    if (Section == Section.Root)
                        return string.Format("~/{0}", Page).FullUrlFromVirtualPath();
                    else
                        return string.Format("~/settings/{0}/{1}", Section, Page).FullUrlFromVirtualPath();
                } 
            }

            public Item(string displayName, Section section, string page,  VisitorRole required)
            {
                DisplayName = displayName;
                Section = section;
                Page = page;
                Required = required;
            }
        }

        private static Item[] menu =
            new Item[]
                {
                    new Item("Home", Section.Root, "default.aspx", VisitorRole.Registered),
					new Item("Account", Section.User, "Account.aspx", VisitorRole.Registered),
                    new Item("List Users", Section.Admin, "ListUsers.aspx", VisitorRole.SuperAdmin),
                    new Item("List Sessions", Section.Admin, "ListSessions.aspx", VisitorRole.SuperAdmin),
                    new Item("Internal Settings", Section.Admin, "InternalSettings.aspx", VisitorRole.SuperAdmin),
                    new Item("Select theme", Section.Theme, "Select.aspx", VisitorRole.Registered),
                    new Item("Theme list", Section.Theme, "DesignList.aspx", VisitorRole.ThemeCreator),
                    new Item("Style list", Section.Theme, "StyleList.aspx", VisitorRole.StyleCreator),
                    new Item("API caller", Section.Sandbox, "DataDocTest.aspx", VisitorRole.ThemeCreator),
                    new Item("Html parse", Section.Sandbox, "HtmlParse.aspx", VisitorRole.ThemeCreator),
                    new Item("Code parse", Section.Sandbox, "Code.aspx", VisitorRole.ThemeCreator),                    
                    new Item("Documents", Section.Sandbox, "Instructions.aspx", VisitorRole.ThemeCreator)
                };

        public static Item[] GetMenu()
        {
            return menu;
        }        
    }
}